﻿(function(){CodeMirror.simpleHint=function(c,n,j){function m(a){function d(){k||(k=!0,e.parentNode.removeChild(e))}function h(){c.replaceRange(g[b.selectedIndex],f.from,f.to);d();setTimeout(function(){c.focus()},50)}if(!c.somethingSelected()){var l=c.getTokenAt(c.getCursor());if(!i.closeOnTokenChange||!(null!=a&&(l.start!=a.start||l.type!=a.type))){var f=n(c,j);if(f&&f.list.length){var g=f.list;if(i.completeSingle&&1==g.length)return c.replaceRange(g[0],f.from,f.to),!0;var e=document.createElement("div");
e.className="CodeMirror-completions";var b=e.appendChild(document.createElement("select"));window.opera||(b.multiple=!0);for(a=0;a<g.length;++a)b.appendChild(document.createElement("option")).appendChild(document.createTextNode(g[a]));b.firstChild.selected=!0;b.size=Math.min(10,g.length);a=c.cursorCoords(i.alignWithWord?f.from:null);e.style.left=a.left+"px";e.style.top=a.bottom+"px";document.body.appendChild(e);if((window.innerWidth||Math.max(document.body.offsetWidth,document.documentElement.offsetWidth))-
a.left<b.clientWidth)e.style.left=a.left-b.clientWidth+"px";10>=g.length&&(e.style.width=b.clientWidth-1+"px");var k=!1;CodeMirror.on(b,"blur",d);CodeMirror.on(b,"keydown",function(b){var a=b.keyCode;if(a==13){CodeMirror.e_stop(b);h()}else if(a==27){CodeMirror.e_stop(b);d();c.focus()}else if(a!=38&&a!=40&&a!=33&&a!=34&&!CodeMirror.isModifierKey(b)){d();c.focus();c.triggerOnKeyDown(b);(!i.closeOnBackspace||a!=8)&&setTimeout(function(){m(l)},50)}});CodeMirror.on(b,"dblclick",h);b.focus();window.opera&&
setTimeout(function(){k||b.focus()},100);return!0}}}}var i={},h=CodeMirror.simpleHint.defaults,d;for(d in h)h.hasOwnProperty(d)&&(i[d]=(j&&j.hasOwnProperty(d)?j:h)[d]);return m()};CodeMirror.simpleHint.defaults={closeOnBackspace:!0,closeOnTokenChange:!1,completeSingle:!0,alignWithWord:!0}})();